diff -r -C 2 -P base/cvs-1.6.5/ChangeLog cvs-1.6.5/ChangeLog
*** base/cvs-1.6.5/ChangeLog	Tue Jan  9 06:20:05 1996
--- cvs-1.6.5/ChangeLog	Wed Jan 10 13:41:54 1996
***************
*** 1,2 ****
--- 1,12 ----
+ Tue Jan  9 12:39:22 1995 Mike Ladwig <mike@twinpeaks.prc.com>
+ 
+ 	* Port of CVS (CVS 1.6.5 snapshot 1/9/96) to MacOS 7.x
+ 	* Virtually all "cvs base" changes are to wrap filesystem calls
+ 	  (e.g. CVS_FOPEN) to allow for pathname changes and permission
+ 	  parameter removal
+ 	* Mac-specific code (rcmd port, fs stuff) all in 'macintosh' subdir
+ 	* Build requires CW GUSI 1.6.4 and CodeWarrier 7
+ 	* 'release' doesn't work, due to cvs implementation approach
+ 
  Mon Jan  8 11:42:40 1996  Jim Kingdon  <kingdon@harvey.cyclic.com>
  
diff -r -C 2 -P base/cvs-1.6.5/lib/regex.c cvs-1.6.5/lib/regex.c
*** base/cvs-1.6.5/lib/regex.c	Tue Oct 10 07:20:24 1995
--- cvs-1.6.5/lib/regex.c	Tue Jan  9 05:33:05 1996
***************
*** 231,236 ****
--- 231,240 ----
  #define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
  
+ #ifndef MAX
  #define MAX(a, b) ((a) > (b) ? (a) : (b))
+ #endif
+ #ifndef MIN
  #define MIN(a, b) ((a) < (b) ? (a) : (b))
+ #endif
  
  typedef char boolean;
diff -r -C 2 -P base/cvs-1.6.5/lib/save-cwd.c cvs-1.6.5/lib/save-cwd.c
*** base/cvs-1.6.5/lib/save-cwd.c	Sat Oct 28 07:20:10 1995
--- cvs-1.6.5/lib/save-cwd.c	Wed Jan 10 13:22:50 1996
***************
*** 122,126 ****
  	}
      }
!   else if (chdir (cwd->name) < 0)
      {
        error (0, errno, "%s", cwd->name);
--- 122,126 ----
  	}
      }
!   else if (CVS_CHDIR (cwd->name) < 0)
      {
        error (0, errno, "%s", cwd->name);
diff -r -C 2 -P base/cvs-1.6.5/lib/system.h cvs-1.6.5/lib/system.h
*** base/cvs-1.6.5/lib/system.h	Thu Jan  4 06:20:14 1996
--- cvs-1.6.5/lib/system.h	Tue Jan  9 05:33:06 1996
***************
*** 434,443 ****
  #endif
  
! /* Under MS-DOS and its derivatives (like Windows NT), mkdir takes only one
!    argument; permission is handled very differently on those systems than in
!    in Unix.  So we leave such systems a hook on which they can hang their
!    own definitions.  */
  #ifndef CVS_MKDIR
  #define CVS_MKDIR mkdir
  #endif
  
--- 434,483 ----
  #endif
  
! /* Under non-UNIX operating systems (MS-DOS, WinNT, MacOS), many filesystem
!    calls take  only one argument; permission is handled very differently on
!    those systems than in Unix.  So we leave such systems a hook on which they
!    can hang their own definitions.  */
  #ifndef CVS_MKDIR
  #define CVS_MKDIR mkdir
+ #endif
+ 
+ #ifndef CVS_MKDIR
+ #define CVS_MKDIR mkdir
+ #endif
+ 
+ #ifndef CVS_OPEN
+ #define CVS_OPEN open
+ #endif
+ 
+ #ifndef CVS_CREAT
+ #define CVS_CREAT creat
+ #endif
+ 
+ #ifndef CVS_FOPEN
+ #define CVS_FOPEN fopen
+ #endif
+ 
+ #ifndef CVS_CHDIR
+ #define CVS_CHDIR chdir
+ #endif
+ 
+ #ifndef CVS_ACCESS
+ #define CVS_ACCESS access
+ #endif
+ 
+ #ifndef CVS_OPENDIR
+ #define CVS_OPENDIR opendir
+ #endif
+ 
+ #ifndef CVS_STAT
+ #define CVS_STAT stat
+ #endif
+ 
+ #ifndef CVS_RENAME
+ #define CVS_RENAME rename
+ #endif
+ 
+ #ifndef CVS_UNLINK
+ #define CVS_UNLINK unlink
  #endif
  
diff -r -C 2 -P base/cvs-1.6.5/src/add.c cvs-1.6.5/src/add.c
*** base/cvs-1.6.5/src/add.c	Thu Jan  4 06:20:24 1996
--- cvs-1.6.5/src/add.c	Tue Jan  9 05:33:07 1996
***************
*** 381,385 ****
      if (save_cwd (&cwd))
  	return (1);
!     if (chdir (dir) < 0)
      {
  	error (0, errno, "cannot chdir to %s", dir);
--- 381,385 ----
      if (save_cwd (&cwd))
  	return (1);
!     if (CVS_CHDIR (dir) < 0)
      {
  	error (0, errno, "cannot chdir to %s", dir);
diff -r -C 2 -P base/cvs-1.6.5/src/checkout.c cvs-1.6.5/src/checkout.c
*** base/cvs-1.6.5/src/checkout.c	Thu Jan  4 06:20:25 1996
--- cvs-1.6.5/src/checkout.c	Tue Jan  9 05:33:07 1996
***************
*** 351,355 ****
  
  	(void) CVS_MKDIR (where, 0777);
! 	if (chdir (where) < 0)
  	    error (1, errno, "cannot chdir to %s", where);
  	preload_update_dir = xstrdup (where);
--- 351,355 ----
  
  	(void) CVS_MKDIR (where, 0777);
! 	if (CVS_CHDIR (where) < 0)
  	    error (1, errno, "cannot chdir to %s", where);
  	preload_update_dir = xstrdup (where);
***************
*** 402,406 ****
  	*slash = '\0';
  
! 	if (chdir (where) < 0)
  	    error (1, errno, "cannot chdir to %s", where);
  
--- 402,406 ----
  	*slash = '\0';
  
! 	if (CVS_CHDIR (where) < 0)
  	    error (1, errno, "cannot chdir to %s", where);
  
***************
*** 716,720 ****
      if (pipeout)
      {
! 	if (chdir (repository) < 0)
  	{
  	    error (0, errno, "cannot chdir to %s", repository);
--- 716,720 ----
      if (pipeout)
      {
! 	if (CVS_CHDIR (repository) < 0)
  	{
  	    error (0, errno, "cannot chdir to %s", repository);
***************
*** 855,859 ****
  	*slash2 = '\0';
  	(void) CVS_MKDIR (cp, 0777);
! 	if (chdir (cp) < 0)
  	{
  	    error (0, errno, "cannot chdir to %s", cp);
--- 855,859 ----
  	*slash2 = '\0';
  	(void) CVS_MKDIR (cp, 0777);
! 	if (CVS_CHDIR (cp) < 0)
  	{
  	    error (0, errno, "cannot chdir to %s", cp);
***************
*** 883,887 ****
      }
      (void) CVS_MKDIR (cp, 0777);
!     if (chdir (cp) < 0)
      {
  	error (0, errno, "cannot chdir to %s", cp);
--- 883,887 ----
      }
      (void) CVS_MKDIR (cp, 0777);
!     if (CVS_CHDIR (cp) < 0)
      {
  	error (0, errno, "cannot chdir to %s", cp);
diff -r -C 2 -P base/cvs-1.6.5/src/client.c cvs-1.6.5/src/client.c
*** base/cvs-1.6.5/src/client.c	Tue Jan  9 06:20:21 1996
--- cvs-1.6.5/src/client.c	Tue Jan  9 05:33:07 1996
***************
*** 375,382 ****
  		error (1, 0, "premature end of file from server");
  	}
- 
- 	if (c == '\n')
- 	    break;
  	
  	result[input_index++] = c;
  	while (input_index + 1 >= result_size)
--- 375,382 ----
  		error (1, 0, "premature end of file from server");
  	}
  	
+ 	if (c == '\012')
+ 	    break;
+ 
  	result[input_index++] = c;
  	while (input_index + 1 >= result_size)
***************
*** 691,697 ****
  		       "could not get working directory: %s", toplevel_wd);
  
! 	if (chdir (toplevel_wd) < 0)
  	    error (1, errno, "could not chdir to %s", toplevel_wd);
! 	if (chdir (dirname) < 0)
  	{
  	    char *dir;
--- 691,697 ----
  		       "could not get working directory: %s", toplevel_wd);
  
! 	if (CVS_CHDIR (toplevel_wd) < 0)
  	    error (1, errno, "could not chdir to %s", toplevel_wd);
! 	if (CVS_CHDIR (dirname) < 0)
  	{
  	    char *dir;
***************
*** 838,842 ****
  	    free (dir);
  	    /* Now it better work.  */
! 	    if (chdir (dirname) < 0)
  		error (1, errno, "could not chdir to %s", dirname);
  	}
--- 838,842 ----
  	    free (dir);
  	    /* Now it better work.  */
! 	    if (CVS_CHDIR (dirname) < 0)
  		error (1, errno, "could not chdir to %s", dirname);
  	}
***************
*** 1087,1091 ****
            bin = 0;
  
!         fd = open (temp_filename,
                     O_WRONLY | O_CREAT | O_TRUNC | (bin ? OPEN_BINARY : 0),
                     0777);
--- 1087,1091 ----
            bin = 0;
  
!         fd = CVS_OPEN (temp_filename,
                     O_WRONLY | O_CREAT | O_TRUNC | (bin ? OPEN_BINARY : 0),
                     0777);
***************
*** 1134,1138 ****
  	        convert_file (temp_filename, O_RDONLY | OPEN_BINARY,
  	    		      filename, O_WRONLY | O_CREAT | O_TRUNC);
! 	        if (unlink (temp_filename) < 0)
  	            error (0, errno, "warning: couldn't delete %s",
                             temp_filename);
--- 1134,1138 ----
  	        convert_file (temp_filename, O_RDONLY | OPEN_BINARY,
  	    		      filename, O_WRONLY | O_CREAT | O_TRUNC);
! 	        if (CVS_UNLINK (temp_filename) < 0)
  	            error (0, errno, "warning: couldn't delete %s",
                             temp_filename);
***************
*** 1156,1160 ****
  	        error (1, 0, "patch original file %s does not exist",
  		       short_pathname);
! 	    if (stat (temp_filename, &s) < 0)
  	        error (1, 1, "can't stat patch file %s", temp_filename);
  	    if (s.st_size == 0)
--- 1156,1160 ----
  	        error (1, 0, "patch original file %s does not exist",
  		       short_pathname);
! 	    if (CVS_STAT (temp_filename, &s) < 0)
  	        error (1, 1, "can't stat patch file %s", temp_filename);
  	    if (s.st_size == 0)
***************
*** 1227,1231 ****
  	     * way they were transmitted.
  	     */
! 	    e = fopen (filename, "r");
  	    if (e == NULL)
  	        error (1, errno, "could not open %s", short_pathname);
--- 1227,1231 ----
  	     * way they were transmitted.
  	     */
! 	    e = CVS_FOPEN (filename, "r");
  	    if (e == NULL)
  	        error (1, errno, "could not open %s", short_pathname);
***************
*** 1639,1643 ****
      if (toplevel_wd[0] != '\0')
        {
! 	if (chdir (toplevel_wd) < 0)
  	  error (1, errno, "could not chdir to %s", toplevel_wd);
        }
--- 1639,1643 ----
      if (toplevel_wd[0] != '\0')
        {
! 	if (CVS_CHDIR (toplevel_wd) < 0)
  	  error (1, errno, "could not chdir to %s", toplevel_wd);
        }
***************
*** 1685,1689 ****
      struct dirent *dp;
  
!     if ((dirp = opendir (dir)) == NULL)
      {
  	if (! existence_error (errno))
--- 1685,1689 ----
      struct dirent *dp;
  
!     if ((dirp = CVS_OPENDIR (dir)) == NULL)
      {
  	if (! existence_error (errno))
***************
*** 1742,1746 ****
      if (toplevel_wd[0] != '\0')
        {
! 	if (chdir (toplevel_wd) < 0)
  	  error (1, errno, "could not chdir to %s", toplevel_wd);
        }
--- 1742,1746 ----
      if (toplevel_wd[0] != '\0')
        {
! 	if (CVS_CHDIR (toplevel_wd) < 0)
  	  error (1, errno, "could not chdir to %s", toplevel_wd);
        }
***************
*** 1828,1832 ****
  	    sprintf (adm_name, "%s/%s", dir, CVSADM_TAG);
  
! 	f = fopen (adm_name, "r");
  	if (f == NULL)
  	{
--- 1828,1832 ----
  	    sprintf (adm_name, "%s/%s", dir, CVSADM_TAG);
  
! 	f = CVS_FOPEN (adm_name, "r");
  	if (f == NULL)
  	{
***************
*** 1860,1864 ****
  	    sprintf (adm_name, "%s/%s", dir, CVSADM_CIPROG);
  
! 	f = fopen (adm_name, "r");
  	if (f == NULL)
  	{
--- 1860,1864 ----
  	    sprintf (adm_name, "%s/%s", dir, CVSADM_CIPROG);
  
! 	f = CVS_FOPEN (adm_name, "r");
  	if (f == NULL)
  	{
***************
*** 1895,1899 ****
  	    sprintf (adm_name, "%s/%s", dir, CVSADM_UPROG);
  
! 	f = fopen (adm_name, "r");
  	if (f == NULL)
  	{
--- 1895,1899 ----
  	    sprintf (adm_name, "%s/%s", dir, CVSADM_UPROG);
  
! 	f = CVS_FOPEN (adm_name, "r");
  	if (f == NULL)
  	{
***************
*** 3181,3185 ****
  
      /* Don't think we can assume fstat exists.  */
!     if (stat (file, &sb) < 0)
  	error (1, errno, "reading %s", short_pathname);
  
--- 3181,3185 ----
  
      /* Don't think we can assume fstat exists.  */
!     if (CVS_STAT (file, &sb) < 0)
  	error (1, errno, "reading %s", short_pathname);
  
***************
*** 3202,3206 ****
        bin = 0;
  
!     fd = open (file, O_RDONLY | (bin ? OPEN_BINARY : 0));
  
      if (fd < 0)
--- 3202,3206 ----
        bin = 0;
  
!     fd = CVS_OPEN (file, O_RDONLY | (bin ? OPEN_BINARY : 0));
  
      if (fd < 0)
***************
*** 3256,3260 ****
  	       the translation mode to created processes via environment
  	       variables, ick.  */
! 	    fd = open (tempfile, O_RDONLY | OPEN_BINARY);
  	    if (fd < 0)
  		error (1, errno, "reading %s", short_pathname);
--- 3256,3260 ----
  	       the translation mode to created processes via environment
  	       variables, ick.  */
! 	    fd = CVS_OPEN (tempfile, O_RDONLY | OPEN_BINARY);
  	    if (fd < 0)
  		error (1, errno, "reading %s", short_pathname);
***************
*** 3297,3301 ****
  	if (converting)
  	{
! 	    if (unlink (tempfile) < 0)
  		error (0, errno,
  		       "warning: can't remove temp file %s", tempfile);
--- 3297,3301 ----
  	if (converting)
  	{
! 	    if (CVS_UNLINK (tempfile) < 0)
  		error (0, errno,
  		       "warning: can't remove temp file %s", tempfile);
***************
*** 3800,3804 ****
  	    if (fclose (fp) < 0)
  		error (0, errno, "cannot close %s", CVSADM_NOTIFY);
! 	    if (unlink (CVSADM_NOTIFY) < 0)
  		error (0, errno, "cannot remove %s", CVSADM_NOTIFY);
  	    return;
--- 3800,3804 ----
  	    if (fclose (fp) < 0)
  		error (0, errno, "cannot close %s", CVSADM_NOTIFY);
! 	    if (CVS_UNLINK (CVSADM_NOTIFY) < 0)
  		error (0, errno, "cannot remove %s", CVSADM_NOTIFY);
  	    return;
***************
*** 3845,3849 ****
  	return;
      }
!     if (rename (CVSADM_NOTIFYTMP, CVSADM_NOTIFY) < 0)
  	error (0, errno, "cannot rename %s to %s", CVSADM_NOTIFYTMP,
  	       CVSADM_NOTIFY);
--- 3845,3849 ----
  	return;
      }
!     if (CVS_RENAME (CVSADM_NOTIFYTMP, CVSADM_NOTIFY) < 0)
  	error (0, errno, "cannot rename %s to %s", CVSADM_NOTIFYTMP,
  	       CVSADM_NOTIFY);
diff -r -C 2 -P base/cvs-1.6.5/src/commit.c cvs-1.6.5/src/commit.c
*** base/cvs-1.6.5/src/commit.c	Fri Jan  5 06:20:20 1996
--- cvs-1.6.5/src/commit.c	Tue Jan  9 05:33:07 1996
***************
*** 297,301 ****
  	    error (1, 0, "cannot specify both a message and a log file");
  
! 	if ((logfd = open (logfile, O_RDONLY | OPEN_BINARY)) < 0)
  	    error (1, errno, "cannot open log file %s", logfile);
  
--- 297,301 ----
  	    error (1, 0, "cannot specify both a message and a log file");
  
! 	if ((logfd = CVS_OPEN (logfile, O_RDONLY | OPEN_BINARY)) < 0)
  	    error (1, errno, "cannot open log file %s", logfile);
  
***************
*** 1088,1092 ****
  	FILE *fp;
  
! 	if ((fp = fopen (CVSADM_CIPROG, "r")) != NULL)
  	{
  	    char *line;
--- 1088,1092 ----
  	FILE *fp;
  
! 	if ((fp = CVS_FOPEN (CVSADM_CIPROG, "r")) != NULL)
  	{
  	    char *line;
***************
*** 1414,1418 ****
  #ifdef DEATH_SUPPORT
  	if (strcmp (rcs, tmp) != 0
! 	    && rename (rcs, tmp) == -1
  	    && (isreadable (rcs) || !isreadable (tmp)))
  	{
--- 1414,1418 ----
  #ifdef DEATH_SUPPORT
  	if (strcmp (rcs, tmp) != 0
! 	    && CVS_RENAME (rcs, tmp) == -1
  	    && (isreadable (rcs) || !isreadable (tmp)))
  	{
***************
*** 1434,1438 ****
  #else /* No DEATH_SUPPORT */
  
! 	if ((strcmp (rcs, tmp) == 0 || rename (rcs, tmp) != -1) ||
  	    (!isreadable (rcs) && isreadable (tmp)))
   	{
--- 1434,1438 ----
  #else /* No DEATH_SUPPORT */
  
! 	if ((strcmp (rcs, tmp) == 0 || CVS_RENAME (rcs, tmp) != -1) ||
  	    (!isreadable (rcs) && isreadable (tmp)))
   	{
***************
*** 1589,1593 ****
  	    
  	    if (strcmp (oldfile, rcs) == 0
! 		|| rename (oldfile, rcs) != 0
  		|| isreadable (oldfile)
  		|| !isreadable (rcs))
--- 1589,1593 ----
  	    
  	    if (strcmp (oldfile, rcs) == 0
! 		|| CVS_RENAME (oldfile, rcs) != 0
  		|| isreadable (oldfile)
  		|| !isreadable (rcs))
***************
*** 1872,1876 ****
      struct stat sb;
  
!     if (stat (user, &sb) != -1)
  	(void) chmod (rcs, (int) sb.st_mode & ~0222);
  }
--- 1872,1876 ----
      struct stat sb;
  
!     if (CVS_STAT (user, &sb) != -1)
  	(void) chmod (rcs, (int) sb.st_mode & ~0222);
  }
diff -r -C 2 -P base/cvs-1.6.5/src/create_adm.c cvs-1.6.5/src/create_adm.c
*** base/cvs-1.6.5/src/create_adm.c	Fri Sep  8 07:20:21 1995
--- cvs-1.6.5/src/create_adm.c	Tue Jan  9 05:33:07 1996
***************
*** 66,70 ****
      else
  	(void) strcpy (tmp, CVSADM_REP);
!     fout = fopen (tmp, "w+");
      if (fout == NULL)
      {
--- 66,70 ----
      else
  	(void) strcpy (tmp, CVSADM_REP);
!     fout = CVS_FOPEN (tmp, "w+");
      if (fout == NULL)
      {
***************
*** 112,116 ****
      else
  	(void) strcpy (tmp, CVSADM_ENT);
!     fout = fopen (tmp, "w+");
      if (fout == NULL)
      {
--- 112,116 ----
      else
  	(void) strcpy (tmp, CVSADM_ENT);
!     fout = CVS_FOPEN (tmp, "w+");
      if (fout == NULL)
      {
diff -r -C 2 -P base/cvs-1.6.5/src/cvs.h cvs-1.6.5/src/cvs.h
*** base/cvs-1.6.5/src/cvs.h	Wed Jan  3 06:20:23 1996
--- cvs-1.6.5/src/cvs.h	Tue Jan  9 05:33:06 1996
***************
*** 231,236 ****
--- 231,241 ----
  #endif
  
+ #ifndef FALSE
  #define	FALSE		0
+ #endif
+ 
+ #ifndef TRUE
  #define	TRUE		1
+ #endif
  
  /*
diff -r -C 2 -P base/cvs-1.6.5/src/diff.c cvs-1.6.5/src/diff.c
*** base/cvs-1.6.5/src/diff.c	Thu Jan  4 06:20:27 1996
--- cvs-1.6.5/src/diff.c	Tue Jan  9 05:33:07 1996
***************
*** 373,377 ****
  	    if (run_exec (RUN_TTY, tmpnam (tmp), RUN_TTY, RUN_REALLY) == -1)
  	    {
! 		(void) unlink (tmp);
  		error (1, errno, "fork failed during checkout of %s",
  		       vers->srcfile->path);
--- 373,377 ----
  	    if (run_exec (RUN_TTY, tmpnam (tmp), RUN_TTY, RUN_REALLY) == -1)
  	    {
! 		(void) CVS_UNLINK (tmp);
  		error (1, errno, "fork failed during checkout of %s",
  		       vers->srcfile->path);
***************
*** 423,427 ****
  
      if (empty_file == DIFF_REMOVED)
! 	(void) unlink (tmp);
  
      (void) fflush (stdout);
--- 423,427 ----
  
      if (empty_file == DIFF_REMOVED)
! 	(void) CVS_UNLINK (tmp);
  
      (void) fflush (stdout);
***************
*** 611,620 ****
  	    if (xcmp (file, tmp) == 0)
  	    {
! 		(void) unlink (tmp);
  		return (1);
  	    }
  	    break;
  	case -1:			/* fork failed */
! 	    (void) unlink (tmp);
  	    error (1, errno, "fork failed during checkout of %s",
  		   vers->srcfile->path);
--- 611,620 ----
  	    if (xcmp (file, tmp) == 0)
  	    {
! 		(void) CVS_UNLINK (tmp);
  		return (1);
  	    }
  	    break;
  	case -1:			/* fork failed */
! 	    (void) CVS_UNLINK (tmp);
  	    error (1, errno, "fork failed during checkout of %s",
  		   vers->srcfile->path);
***************
*** 622,626 ****
  	    break;
      }
!     (void) unlink (tmp);
      return (0);
  }
--- 622,626 ----
  	    break;
      }
!     (void) CVS_UNLINK (tmp);
      return (0);
  }
diff -r -C 2 -P base/cvs-1.6.5/src/edit.c cvs-1.6.5/src/edit.c
*** base/cvs-1.6.5/src/edit.c	Thu Jan  4 06:20:27 1996
--- cvs-1.6.5/src/edit.c	Tue Jan  9 05:33:07 1996
***************
*** 180,184 ****
         is most sensible.  */
  
!     fp = fopen (CVSADM_NOTIFY, "r");
      if (fp == NULL)
      {
--- 180,184 ----
         is most sensible.  */
  
!     fp = CVS_FOPEN (CVSADM_NOTIFY, "r");
      if (fp == NULL)
      {
***************
*** 225,229 ****
  	error (0, errno, "cannot close %s", CVSADM_NOTIFY);
  
!     if (unlink (CVSADM_NOTIFY) < 0)
  	error (0, errno, "cannot remove %s", CVSADM_NOTIFY);
  
--- 225,229 ----
  	error (0, errno, "cannot close %s", CVSADM_NOTIFY);
  
!     if (CVS_UNLINK (CVSADM_NOTIFY) < 0)
  	error (0, errno, "cannot remove %s", CVSADM_NOTIFY);
  
***************
*** 810,814 ****
         is most sensible.  */
  
!     fp = fopen (CVSADM_NOTIFY, "r");
      if (fp == NULL)
      {
--- 810,814 ----
         is most sensible.  */
  
!     fp = CVS_FOPEN (CVSADM_NOTIFY, "r");
      if (fp == NULL)
      {
diff -r -C 2 -P base/cvs-1.6.5/src/entries.c cvs-1.6.5/src/entries.c
*** base/cvs-1.6.5/src/entries.c	Thu Jan  4 06:20:28 1996
--- cvs-1.6.5/src/entries.c	Tue Jan  9 05:33:07 1996
***************
*** 280,284 ****
  	{
  	    struct stat sb;
! 	    if (strlen (ts) > 30 && stat (user, &sb) == 0)
  	    {
  		char *c = ctime (&sb.st_mtime);
--- 280,284 ----
  	{
  	    struct stat sb;
! 	    if (strlen (ts) > 30 && CVS_STAT (user, &sb) == 0)
  	    {
  		char *c = ctime (&sb.st_mtime);
***************
*** 373,377 ****
      }
  
!     fpin = fopen (CVSADM_ENT, "r");
      if (fpin == NULL)
  	error (0, errno, "cannot open %s for reading", CVSADM_ENT);
--- 373,377 ----
      }
  
!     fpin = CVS_FOPEN (CVSADM_ENT, "r");
      if (fpin == NULL)
  	error (0, errno, "cannot open %s for reading", CVSADM_ENT);
***************
*** 384,390 ****
  
  	fclose (fpin);
      }
  
!     fpin = fopen (CVSADM_ENTLOG, "r");
      if (fpin != NULL) 
      {
--- 384,391 ----
  
  	fclose (fpin);
+ 	fpin = NULL;
      }
  
!     fpin = CVS_FOPEN (CVSADM_ENTLOG, "r");
      if (fpin != NULL) 
      {
***************
*** 395,398 ****
--- 396,400 ----
  	do_rewrite = 1;
  	fclose (fpin);
+ 	fpin = NULL;
      }
  
***************
*** 528,532 ****
      if (datep)
  	*datep = (char *) NULL;
!     fp = fopen (CVSADM_TAG, "r");
      if (fp)
      {
--- 530,534 ----
      if (datep)
  	*datep = (char *) NULL;
!     fp = CVS_FOPEN (CVSADM_TAG, "r");
      if (fp)
      {
diff -r -C 2 -P base/cvs-1.6.5/src/error.c cvs-1.6.5/src/error.c
*** base/cvs-1.6.5/src/error.c	Sat Dec 16 06:20:29 1995
--- cvs-1.6.5/src/error.c	Tue Jan  9 05:33:07 1996
***************
*** 67,71 ****
--- 67,73 ----
  #endif /* STDC_HEADERS */
  
+ #ifndef macintosh
  extern char *strerror ();
+ #endif
  
  typedef void (*fn_returning_void) PROTO((void));
diff -r -C 2 -P base/cvs-1.6.5/src/fileattr.c cvs-1.6.5/src/fileattr.c
*** base/cvs-1.6.5/src/fileattr.c	Fri Dec 22 06:20:27 1995
--- cvs-1.6.5/src/fileattr.c	Tue Jan  9 05:33:07 1996
***************
*** 79,83 ****
  
      attr_read_attempted = 1;
!     fp = fopen (fname, "r");
      if (fp == NULL)
      {
--- 79,83 ----
  
      attr_read_attempted = 1;
!     fp = CVS_FOPEN (fname, "r");
      if (fp == NULL)
      {
***************
*** 440,444 ****
  
      omask = umask (cvsumask);
!     fp = fopen (fname, "w");
      if (fp == NULL)
      {
--- 440,444 ----
  
      omask = umask (cvsumask);
!     fp = CVS_FOPEN (fname, "w");
      if (fp == NULL)
      {
***************
*** 465,469 ****
  	    free (repname);
  
! 	    fp = fopen (fname, "w");
  	}
  	if (fp == NULL)
--- 465,469 ----
  	    free (repname);
  
! 	    fp = CVS_FOPEN (fname, "w");
  	}
  	if (fp == NULL)
diff -r -C 2 -P base/cvs-1.6.5/src/filesubr.c cvs-1.6.5/src/filesubr.c
*** base/cvs-1.6.5/src/filesubr.c	Tue Jan  2 06:20:27 1996
--- cvs-1.6.5/src/filesubr.c	Tue Jan  9 05:48:57 1996
***************
*** 61,69 ****
  	return;
  
!     if ((fdin = open (from, O_RDONLY)) < 0)
  	error (1, errno, "cannot open %s for copying", from);
      if (fstat (fdin, &sb) < 0)
  	error (1, errno, "cannot fstat %s", from);
!     if ((fdout = creat (to, (int) sb.st_mode & 07777)) < 0)
  	error (1, errno, "cannot create %s for copying", to);
      if (sb.st_size > 0)
--- 61,69 ----
  	return;
  
!     if ((fdin = CVS_OPEN (from, O_RDONLY)) < 0)
  	error (1, errno, "cannot open %s for copying", from);
      if (fstat (fdin, &sb) < 0)
  	error (1, errno, "cannot fstat %s", from);
!     if ((fdout = CVS_CREAT (to, (int) sb.st_mode & 07777)) < 0)
  	error (1, errno, "cannot create %s for copying", to);
      if (sb.st_size > 0)
***************
*** 122,126 ****
      struct stat sb;
  
!     if (stat (file, &sb) < 0)
  	return (0);
      return (S_ISDIR (sb.st_mode));
--- 122,126 ----
      struct stat sb;
  
!     if (CVS_STAT (file, &sb) < 0)
  	return (0);
      return (S_ISDIR (sb.st_mode));
***************
*** 192,196 ****
      int uid;
      
!     if (stat(file, &sb) == -1)
  	return 0;
      if (mode == F_OK)
--- 192,196 ----
      int uid;
      
!     if (CVS_STAT(file, &sb) == -1)
  	return 0;
      if (mode == F_OK)
***************
*** 232,236 ****
  	return (sb.st_mode & omask) == omask;
  #else
!     return access(file, mode) == 0;
  #endif
  }
--- 232,236 ----
  	return (sb.st_mode & omask) == omask;
  #else
!     return CVS_ACCESS (file, mode) == 0;
  #endif
  }
***************
*** 246,250 ****
      FILE *fp;
  
!     if ((fp = fopen (name, mode)) == NULL)
  	error (1, errno, "cannot open %s", name);
      return (fp);
--- 246,250 ----
      FILE *fp;
  
!     if ((fp = CVS_FOPEN (name, mode)) == NULL)
  	error (1, errno, "cannot open %s", name);
      return (fp);
***************
*** 260,266 ****
      struct stat sb;
  
!     if (stat (name, &sb) == 0 && (!S_ISDIR (sb.st_mode)))
  	    error (0, 0, "%s already exists but is not a directory", name);
!     if (!noexec && mkdir (name, 0777) < 0)
  	error (1, errno, "cannot make directory %s", name);
  }
--- 260,266 ----
      struct stat sb;
  
!     if (CVS_STAT (name, &sb) == 0 && (!S_ISDIR (sb.st_mode)))
  	    error (0, 0, "%s already exists but is not a directory", name);
!     if (!noexec && CVS_MKDIR (name, 0777) < 0)
  	error (1, errno, "cannot make directory %s", name);
  }
***************
*** 279,283 ****
  	return;
  
!     if (mkdir (name, 0777) == 0 || errno == EEXIST)
  	return;
      if (! existence_error (errno))
--- 279,283 ----
  	return;
  
!     if (CVS_MKDIR (name, 0777) == 0 || errno == EEXIST)
  	return;
      if (! existence_error (errno))
***************
*** 293,297 ****
      if (*cp == '\0')
  	return;
!     (void) mkdir (name, 0777);
  }
  
--- 293,297 ----
      if (*cp == '\0')
  	return;
!     (void) CVS_MKDIR (name, 0777);
  }
  
***************
*** 308,312 ****
      mode_t mode, oumask;
  
!     if (stat (fname, &sb) < 0)
      {
  	if (!noexec)
--- 308,312 ----
      mode_t mode, oumask;
  
!     if (CVS_STAT (fname, &sb) < 0)
      {
  	if (!noexec)
***************
*** 360,364 ****
  	return;
  
!     if (rename (from, to) < 0)
  	error (1, errno, "cannot rename file %s to %s", from, to);
  }
--- 360,364 ----
  	return;
  
!     if (CVS_RENAME (from, to) < 0)
  	error (1, errno, "cannot rename file %s to %s", from, to);
  }
***************
*** 384,388 ****
--- 384,392 ----
  	return (0);
  
+ #ifdef macintosh
+     return (symlink (from, to));
+ #else
      return (link (from, to));
+ #endif
  }
  
***************
*** 404,408 ****
  	return (0);
  
!     return (unlink (f));
  }
  
--- 408,412 ----
  	return (0);
  
!     return (CVS_UNLINK (f));
  }
  
***************
*** 426,430 ****
  	return (0);
  
!     if (unlink (f) != 0)
      {
  	/* under NEXTSTEP errno is set to return EPERM if
--- 430,434 ----
  	return (0);
  
!     if (CVS_UNLINK (f) != 0)
      {
  	/* under NEXTSTEP errno is set to return EPERM if
***************
*** 461,465 ****
      if ( rmdir (path) != 0 && errno == ENOTEMPTY )
      {
! 	if ((dirp = opendir (path)) == NULL)
  	    /* If unable to open the directory return
  	     * an error
--- 465,469 ----
      if ( rmdir (path) != 0 && errno == ENOTEMPTY )
      {
! 	if ((dirp = CVS_OPENDIR (path)) == NULL)
  	    /* If unable to open the directory return
  	     * an error
***************
*** 475,479 ****
  	    sprintf (buf, "%s/%s", path, dp->d_name);
  
! 	    if (unlink (buf) != 0 )
  	    {
  		if (errno == EISDIR || errno == EPERM)
--- 479,483 ----
  	    sprintf (buf, "%s/%s", path, dp->d_name);
  
! 	    if (CVS_UNLINK (buf) != 0 )
  	    {
  		if (errno == EISDIR || errno == EPERM)
***************
*** 550,556 ****
      int ret;
  
!     if ((fd1 = open (file1, O_RDONLY)) < 0)
  	error (1, errno, "cannot open file %s for comparing", file1);
!     if ((fd2 = open (file2, O_RDONLY)) < 0)
  	error (1, errno, "cannot open file %s for comparing", file2);
      if (fstat (fd1, &sb1) < 0)
--- 554,560 ----
      int ret;
  
!     if ((fd1 = CVS_OPEN (file1, O_RDONLY)) < 0)
  	error (1, errno, "cannot open file %s for comparing", file1);
!     if ((fd2 = CVS_OPEN (file2, O_RDONLY)) < 0)
  	error (1, errno, "cannot open file %s for comparing", file2);
      if (fstat (fd1, &sb1) < 0)
diff -r -C 2 -P base/cvs-1.6.5/src/find_names.c cvs-1.6.5/src/find_names.c
*** base/cvs-1.6.5/src/find_names.c	Sat Dec 16 06:20:30 1995
--- cvs-1.6.5/src/find_names.c	Tue Jan  9 05:33:07 1996
***************
*** 129,133 ****
  	/* look only for CVS controlled sub-directories */
  	if (find_dirs (".", dirlist, 1) != 0)
! 	    error (1, errno, "cannot open current directory");
      }
  
--- 129,133 ----
  	/* look only for CVS controlled sub-directories */
  	if (find_dirs (".", dirlist, 1) != 0)
! 	    error (1, errno, "cannot open current directory\n");
      }
  
***************
*** 171,175 ****
  
      /* set up to read the dir */
!     if ((dirp = opendir (dir)) == NULL)
  	return (1);
  
--- 171,175 ----
  
      /* set up to read the dir */
!     if ((dirp = CVS_OPENDIR (dir)) == NULL)
  	return (1);
  
***************
*** 211,217 ****
  
      /* set up to read the dir */
!     if ((dirp = opendir (dir)) == NULL)
  	return (1);
- 
      /* read the dir, grabbing sub-dirs */
      while ((dp = readdir (dirp)) != NULL)
--- 211,216 ----
  
      /* set up to read the dir */
!     if ((dirp = CVS_OPENDIR (dir)) == NULL)
  	return (1);
      /* read the dir, grabbing sub-dirs */
      while ((dp = readdir (dirp)) != NULL)
diff -r -C 2 -P base/cvs-1.6.5/src/history.c cvs-1.6.5/src/history.c
*** base/cvs-1.6.5/src/history.c	Thu Jan  4 06:20:28 1996
--- cvs-1.6.5/src/history.c	Tue Jan  9 05:33:07 1996
***************
*** 702,706 ****
      if (noexec)
  	return;
!     if ((fd = open (fname, O_WRONLY | O_APPEND | O_CREAT, 0666)) < 0)
  	error (1, errno, "cannot open history file: %s", fname);
  
--- 702,706 ----
      if (noexec)
  	return;
!     if ((fd = CVS_OPEN (fname, O_WRONLY | O_APPEND | O_CREAT, 0666)) < 0)
  	error (1, errno, "cannot open history file: %s", fname);
  
***************
*** 729,737 ****
  		if (!getwd (workdir))
  		    error (1, errno, "can't getwd in history");
! 		if (chdir (pw->pw_dir) < 0)
  		    error (1, errno, "can't chdir(%s)", pw->pw_dir);
  		if (!getwd (homedir))
  		    error (1, errno, "can't getwd in %s", pw->pw_dir);
! 		(void) chdir (workdir);
  
  		i = strlen (homedir);
--- 729,737 ----
  		if (!getwd (workdir))
  		    error (1, errno, "can't getwd in history");
! 		if (CVS_CHDIR (pw->pw_dir) < 0)
  		    error (1, errno, "can't chdir(%s)", pw->pw_dir);
  		if (!getwd (homedir))
  		    error (1, errno, "can't getwd in %s", pw->pw_dir);
! 		(void) CVS_CHDIR (workdir);
  
  		i = strlen (homedir);
***************
*** 1001,1005 ****
      struct stat st_buf;
  
!     if ((fd = open (fname, O_RDONLY)) < 0)
  	error (1, errno, "cannot open history file: %s", fname);
  
--- 1001,1005 ----
      struct stat st_buf;
  
!     if ((fd = CVS_OPEN (fname, O_RDONLY)) < 0)
  	error (1, errno, "cannot open history file: %s", fname);
  
diff -r -C 2 -P base/cvs-1.6.5/src/ignore.c cvs-1.6.5/src/ignore.c
*** base/cvs-1.6.5/src/ignore.c	Thu Jan  4 06:20:29 1996
--- cvs-1.6.5/src/ignore.c	Tue Jan  9 05:33:07 1996
***************
*** 132,136 ****
  
      /* load the file */
!     fp = fopen (file, "r");
      if (fp == NULL)
      {
--- 132,136 ----
  
      /* load the file */
!     fp = CVS_FOPEN (file, "r");
      if (fp == NULL)
      {
***************
*** 317,321 ****
  	xdir = update_dir;
  
!     dirp = opendir (".");
      if (dirp == NULL)
  	return;
--- 317,321 ----
  	xdir = update_dir;
  
!     dirp = CVS_OPENDIR (".");
      if (dirp == NULL)
  	return;
diff -r -C 2 -P base/cvs-1.6.5/src/import.c cvs-1.6.5/src/import.c
*** base/cvs-1.6.5/src/import.c	Thu Jan  4 06:20:29 1996
--- cvs-1.6.5/src/import.c	Tue Jan  9 05:33:08 1996
***************
*** 250,256 ****
  
      /* Create the logfile that will be logged upon completion */
!     if ((logfp = fopen (tmpnam (tmpfile), "w+")) == NULL)
  	error (1, errno, "cannot create temporary file `%s'", tmpfile);
!     (void) unlink (tmpfile);		/* to be sure it goes away */
      (void) fprintf (logfp, "\nVendor Tag:\t%s\n", argv[1]);
      (void) fprintf (logfp, "Release Tags:\t");
--- 250,256 ----
  
      /* Create the logfile that will be logged upon completion */
!     if ((logfp = CVS_FOPEN (tmpnam (tmpfile), "w+")) == NULL)
  	error (1, errno, "cannot create temporary file `%s'", tmpfile);
!     (void) CVS_UNLINK (tmpfile);		/* to be sure it goes away */
      (void) fprintf (logfp, "\nVendor Tag:\t%s\n", argv[1]);
      (void) fprintf (logfp, "Release Tags:\t");
***************
*** 302,306 ****
      /* Make sure the temporary file goes away, even on systems that don't let
         you delete a file that's in use.  */
!     unlink (tmpfile);
  
      if (message)
--- 302,306 ----
      /* Make sure the temporary file goes away, even on systems that don't let
         you delete a file that's in use.  */
!     CVS_UNLINK (tmpfile);
  
      if (message)
***************
*** 329,333 ****
      wrap_add_file (CVSDOTWRAPPER, 1);
  
!     if ((dirp = opendir (".")) == NULL)
      {
  	err++;
--- 329,333 ----
      wrap_add_file (CVSDOTWRAPPER, 1);
  
!     if ((dirp = CVS_OPENDIR (".")) == NULL)
      {
  	err++;
***************
*** 867,871 ****
      tocvsPath = wrap_tocvs_process_file (user);
      userfile = (tocvsPath == NULL ? user : tocvsPath);
!     fpuser = fopen (userfile, "r");
      if (fpuser == NULL) {
  	/* not fatal, continue import */
--- 867,871 ----
      tocvsPath = wrap_tocvs_process_file (user);
      userfile = (tocvsPath == NULL ? user : tocvsPath);
!     fpuser = CVS_FOPEN (userfile, "r");
      if (fpuser == NULL) {
  	/* not fatal, continue import */
***************
*** 874,878 ****
  	goto read_error;
      }
!     fprcs = fopen (rcs, "w+");
      if (fprcs == NULL) {
  	ierrno = errno;
--- 874,878 ----
  	goto read_error;
      }
!     fprcs = CVS_FOPEN (rcs, "w+");
      if (fprcs == NULL) {
  	ierrno = errno;
***************
*** 1036,1040 ****
      if (ierrno == ENOSPC)
      {
! 	(void) unlink (rcs);
  	fperror (logfp, 0, 0, "ERROR: out of space - aborting");
  	error (1, 0, "ERROR: out of space - aborting");
--- 1036,1040 ----
      if (ierrno == ENOSPC)
      {
! 	(void) CVS_UNLINK (rcs);
  	fperror (logfp, 0, 0, "ERROR: out of space - aborting");
  	error (1, 0, "ERROR: out of space - aborting");
***************
*** 1149,1153 ****
  #endif
  
!     if (chdir (dir) < 0)
      {
  	ierrno = errno;
--- 1149,1153 ----
  #endif
  
!     if (CVS_CHDIR (dir) < 0)
      {
  	ierrno = errno;
diff -r -C 2 -P base/cvs-1.6.5/src/lock.c cvs-1.6.5/src/lock.c
*** base/cvs-1.6.5/src/lock.c	Mon Dec 18 06:20:26 1995
--- cvs-1.6.5/src/lock.c	Tue Jan  9 05:33:08 1996
***************
*** 84,88 ****
      {
  	(void) sprintf (tmp, "%s/%s", repository, readlock);
! 	if (unlink (tmp) < 0 && ! existence_error (errno))
  	    error (0, errno, "failed to remove lock %s", tmp);
      }
--- 84,88 ----
      {
  	(void) sprintf (tmp, "%s/%s", repository, readlock);
! 	if (CVS_UNLINK (tmp) < 0 && ! existence_error (errno))
  	    error (0, errno, "failed to remove lock %s", tmp);
      }
***************
*** 91,95 ****
      {
  	(void) sprintf (tmp, "%s/%s", repository, writelock);
! 	if (unlink (tmp) < 0 && ! existence_error (errno))
  	    error (0, errno, "failed to remove lock %s", tmp);
      }
--- 91,95 ----
      {
  	(void) sprintf (tmp, "%s/%s", repository, writelock);
! 	if (CVS_UNLINK (tmp) < 0 && ! existence_error (errno))
  	    error (0, errno, "failed to remove lock %s", tmp);
      }
***************
*** 133,137 ****
    /* Check if the uidlock is in the lock directory */
    sprintf(uidlock, "%s/uidlock%d", lockdir, geteuid() );
!   if( stat(uidlock, &sb) != -1)
      return 1;   /* The file exists, therefore we own the lock */
    else
--- 133,137 ----
    /* Check if the uidlock is in the lock directory */
    sprintf(uidlock, "%s/uidlock%d", lockdir, geteuid() );
!   if( CVS_STAT (uidlock, &sb) != -1)
      return 1;   /* The file exists, therefore we own the lock */
    else
***************
*** 140,144 ****
  		 */
  #else
!   if (stat (lockdir, &sb) != -1 && sb.st_uid == geteuid ())
      return 1;
    else
--- 140,144 ----
  		 */
  #else
!   if (CVS_STAT (lockdir, &sb) != -1 && sb.st_uid == geteuid ())
      return 1;
    else
***************
*** 190,203 ****
  #endif
  	getpid());
!     if ((fp = fopen (tmp, "w+")) == NULL || fclose (fp) == EOF)
      {
  	error (0, errno, "cannot create read lock in repository `%s'",
  	       xrepository);
  	readlock[0] = '\0';
! 	if (unlink (tmp) < 0 && ! existence_error (errno))
  	    error (0, errno, "failed to remove lock %s", tmp);
  	return (1);
      }
!     if (unlink (tmp) < 0)
  	error (0, errno, "failed to remove lock %s", tmp);
  #endif
--- 190,203 ----
  #endif
  	getpid());
!     if ((fp = CVS_FOPEN (tmp, "w+")) == NULL || fclose (fp) == EOF)
      {
  	error (0, errno, "cannot create read lock in repository `%s'",
  	       xrepository);
  	readlock[0] = '\0';
! 	if (CVS_UNLINK (tmp) < 0 && ! existence_error (errno))
  	    error (0, errno, "failed to remove lock %s", tmp);
  	return (1);
      }
!     if (CVS_UNLINK (tmp) < 0)
  	error (0, errno, "failed to remove lock %s", tmp);
  #endif
***************
*** 214,218 ****
      /* write a read-lock */
      (void) sprintf (tmp, "%s/%s", xrepository, readlock);
!     if ((fp = fopen (tmp, "w+")) == NULL || fclose (fp) == EOF)
      {
  	error (0, errno, "cannot create read lock in repository `%s'",
--- 214,218 ----
      /* write a read-lock */
      (void) sprintf (tmp, "%s/%s", xrepository, readlock);
!     if ((fp = CVS_FOPEN (tmp, "w+")) == NULL || fclose (fp) == EOF)
      {
  	error (0, errno, "cannot create read lock in repository `%s'",
***************
*** 328,340 ****
  #endif
  	getpid ());
!     if ((fp = fopen (tmp, "w+")) == NULL || fclose (fp) == EOF)
      {
  	error (0, errno, "cannot create write lock in repository `%s'",
  	       repository);
! 	if (unlink (tmp) < 0 && ! existence_error (errno))
  	    error (0, errno, "failed to remove lock %s", tmp);
  	return (L_ERROR);
      }
!     if (unlink (tmp) < 0)
  	error (0, errno, "failed to remove lock %s", tmp);
  #endif
--- 328,340 ----
  #endif
  	getpid ());
!     if ((fp = CVS_FOPEN (tmp, "w+")) == NULL || fclose (fp) == EOF)
      {
  	error (0, errno, "cannot create write lock in repository `%s'",
  	       repository);
! 	if (CVS_UNLINK (tmp) < 0 && ! existence_error (errno))
  	    error (0, errno, "failed to remove lock %s", tmp);
  	return (L_ERROR);
      }
!     if (CVS_UNLINK (tmp) < 0)
  	error (0, errno, "failed to remove lock %s", tmp);
  #endif
***************
*** 359,367 ****
  	/* write the write-lock file */
  	(void) sprintf (tmp, "%s/%s", repository, writelock);
! 	if ((fp = fopen (tmp, "w+")) == NULL || fclose (fp) == EOF)
  	{
  	    int xerrno = errno;
  
! 	    if (unlink (tmp) < 0 && ! existence_error (errno))
  		error (0, errno, "failed to remove lock %s", tmp);
  
--- 359,367 ----
  	/* write the write-lock file */
  	(void) sprintf (tmp, "%s/%s", repository, writelock);
! 	if ((fp = CVS_FOPEN (tmp, "w+")) == NULL || fclose (fp) == EOF)
  	{
  	    int xerrno = errno;
  
! 	    if (CVS_UNLINK (tmp) < 0 && ! existence_error (errno))
  		error (0, errno, "failed to remove lock %s", tmp);
  
***************
*** 402,406 ****
  #endif
  
!     if ((dirp = opendir (repository)) == NULL)
  	error (1, 0, "cannot open directory %s", repository);
  
--- 402,406 ----
  #endif
  
!     if ((dirp = CVS_OPENDIR (repository)) == NULL)
  	error (1, 0, "cannot open directory %s", repository);
  
***************
*** 417,421 ****
  	    line = xmalloc (strlen (repository) + strlen (dp->d_name) + 5);
  	    (void) sprintf (line, "%s/%s", repository, dp->d_name);
! 	    if (stat (line, &sb) != -1)
  	    {
  #ifdef CVS_FUDGELOCKS
--- 417,421 ----
  	    line = xmalloc (strlen (repository) + strlen (dp->d_name) + 5);
  	    (void) sprintf (line, "%s/%s", repository, dp->d_name);
! 	    if (CVS_STAT (line, &sb) != -1)
  	    {
  #ifdef CVS_FUDGELOCKS
***************
*** 425,429 ****
  		 * successful, re-open the directory and try again.
  		 */
! 		if (now >= (sb.st_ctime + CVSLCKAGE) && unlink (line) != -1)
  		{
  		    (void) closedir (dirp);
--- 425,429 ----
  		 * successful, re-open the directory and try again.
  		 */
! 		if (now >= (sb.st_ctime + CVSLCKAGE) && CVS_UNLINK (line) != -1)
  		{
  		    (void) closedir (dirp);
***************
*** 503,507 ****
  
  	    sprintf(uidlock, "%s/uidlock%d", masterlock, geteuid() );
! 	    if ((fp = fopen(uidlock, "w+")) == NULL)
  	    {
  		/* We failed to create the uidlock,
--- 503,507 ----
  
  	    sprintf(uidlock, "%s/uidlock%d", masterlock, geteuid() );
! 	    if ((fp = CVS_FOPEN (uidlock, "w+")) == NULL)
  	    {
  		/* We failed to create the uidlock,
***************
*** 539,543 ****
  	 * someone probably just removed it (thus releasing the lock)
  	 */
! 	if (stat (masterlock, &sb) < 0)
  	{
  	    if (existence_error (errno))
--- 539,543 ----
  	 * someone probably just removed it (thus releasing the lock)
  	 */
! 	if (CVS_STAT (masterlock, &sb) < 0)
  	{
  	    if (existence_error (errno))
diff -r -C 2 -P base/cvs-1.6.5/src/login.c cvs-1.6.5/src/login.c
*** base/cvs-1.6.5/src/login.c	Sun Dec 24 06:20:24 1995
--- cvs-1.6.5/src/login.c	Tue Jan  9 05:33:08 1996
***************
*** 192,196 ****
       inefficient, but we're not talking about a gig of data here. */
  
!   fp = fopen (passfile, "r");
    if (fp != NULL)
      {
--- 192,196 ----
       inefficient, but we're not talking about a gig of data here. */
  
!   fp = CVS_FOPEN (passfile, "r");
    if (fp != NULL)
      {
***************
*** 232,236 ****
  
            tmp_name = tmpnam (NULL);
!           if ((tmp_fp = fopen (tmp_name, "w")) == NULL)
              {
                error (1, errno, "unable to open temp file %s", tmp_name);
--- 232,236 ----
  
            tmp_name = tmpnam (NULL);
!           if ((tmp_fp = CVS_FOPEN (tmp_name, "w")) == NULL)
              {
                error (1, errno, "unable to open temp file %s", tmp_name);
***************
*** 239,243 ****
            chmod (tmp_name, 0600);
  
!           fp = fopen (passfile, "r");
            if (fp == NULL)
              {
--- 239,243 ----
            chmod (tmp_name, 0600);
  
!           fp = CVS_FOPEN (passfile, "r");
            if (fp == NULL)
              {
***************
*** 268,272 ****
    else
      {
!       if ((fp = fopen (passfile, "a")) == NULL)
          {
            error (1, errno, "could not open %s", passfile);
--- 268,272 ----
    else
      {
!       if ((fp = CVS_FOPEN (passfile, "a")) == NULL)
          {
            error (1, errno, "could not open %s", passfile);
***************
*** 327,331 ****
    /* Else get it from the file. */
    passfile = construct_cvspass_filename ();
!   fp = fopen (passfile, "r");
    if (fp == NULL)
      {
--- 327,331 ----
    /* Else get it from the file. */
    passfile = construct_cvspass_filename ();
!   fp = CVS_FOPEN (passfile, "r");
    if (fp == NULL)
      {
diff -r -C 2 -P base/cvs-1.6.5/src/logmsg.c cvs-1.6.5/src/logmsg.c
*** base/cvs-1.6.5/src/logmsg.c	Mon Dec 25 06:20:18 1995
--- cvs-1.6.5/src/logmsg.c	Tue Jan  9 05:33:08 1996
***************
*** 145,149 ****
      (void) tmpnam (fname);
    again:
!     if ((fp = fopen (fname, "w+")) == NULL)
  	error (1, 0, "cannot create temporary file %s", fname);
  
--- 145,149 ----
      (void) tmpnam (fname);
    again:
!     if ((fp = CVS_FOPEN (fname, "w+")) == NULL)
  	error (1, 0, "cannot create temporary file %s", fname);
  
***************
*** 180,184 ****
      if (fclose (fp) == EOF)
          error (1, errno, "%s", fname);
!     if (stat (fname, &pre_stbuf) == -1)
  	pre_stbuf.st_mtime = 0;
  
--- 180,184 ----
      if (fclose (fp) == EOF)
          error (1, errno, "%s", fname);
!     if (CVS_STAT (fname, &pre_stbuf) == -1)
  	pre_stbuf.st_mtime = 0;
  
***************
*** 205,209 ****
  	free (*messagep);
  
!     if (stat (fname, &post_stbuf) != 0)
  	    error (1, errno, "cannot find size of temp file %s", fname);
  
--- 205,209 ----
  	free (*messagep);
  
!     if (CVS_STAT (fname, &post_stbuf) != 0)
  	    error (1, errno, "cannot find size of temp file %s", fname);
  
***************
*** 293,297 ****
      last_template = xstrdup (template);
  
!     if ((tfp = fopen (template, "r")) != NULL)
      {
  	char *line = NULL;
--- 293,297 ----
      last_template = xstrdup (template);
  
!     if ((tfp = CVS_FOPEN (template, "r")) != NULL)
      {
  	char *line = NULL;
diff -r -C 2 -P base/cvs-1.6.5/src/main.c cvs-1.6.5/src/main.c
*** base/cvs-1.6.5/src/main.c	Sat Dec 16 06:20:32 1995
--- cvs-1.6.5/src/main.c	Tue Jan  9 05:33:08 1996
***************
*** 37,40 ****
--- 37,44 ----
  #include "patchlevel.h"
  
+ #ifdef macintosh
+ #include <sioux.h>
+ #endif
+ 
  #if HAVE_KERBEROS
  #include <sys/socket.h>
***************
*** 269,272 ****
--- 273,285 ----
          don't use it. */
      int option_index = 0;
+ 
+ #ifdef macintosh
+ 	GUSIDefaultSetup();
+ 	argc = ccommand(&argv);
+ 
+ 	SIOUXSettings.showstatusline = TRUE;
+ 	SIOUXSettings.asktosaveonclose = FALSE;
+ 
+ #endif
  
      error_set_cleanup (error_cleanup);
diff -r -C 2 -P base/cvs-1.6.5/src/modules.c cvs-1.6.5/src/modules.c
*** base/cvs-1.6.5/src/modules.c	Thu Jan  4 06:20:30 1996
--- cvs-1.6.5/src/modules.c	Tue Jan  9 05:33:08 1996
***************
*** 338,342 ****
  		     instead of just at the bottom */
  	    make_directories (dir);
! 	    if (chdir (dir) < 0)
  	    {
  		error (0, errno, "cannot chdir to %s", dir);
--- 338,342 ----
  		     instead of just at the bottom */
  	    make_directories (dir);
! 	    if (CVS_CHDIR (dir) < 0)
  	    {
  		error (0, errno, "cannot chdir to %s", dir);
***************
*** 643,647 ****
  static int s_count = 0;			/* Number of elements used */
  
! static int Status;		        /* Nonzero if the user is
  					   interested in status
  					   information as well as
--- 643,647 ----
  static int s_count = 0;			/* Number of elements used */
  
! static int capsstatus;		        /* Nonzero if the user is
  					   interested in status
  					   information as well as
***************
*** 663,667 ****
      const struct sortrec *right = (const struct sortrec *) r;
  
!     if (Status)
      {
  	/* If Sort by status field, compare them. */
--- 663,667 ----
      const struct sortrec *right = (const struct sortrec *) r;
  
!     if (capsstatus)
      {
  	/* If Sort by status field, compare them. */
***************
*** 682,686 ****
      struct sortrec *s_rec;
  
!     if (Status && *d == '-' && *(d + 1) == 'a')
  	return;				/* We want "cvs co -s" and it is an alias! */
  
--- 682,686 ----
      struct sortrec *s_rec;
  
!     if (capsstatus && *d == '-' && *(d + 1) == 'a')
  	return;				/* We want "cvs co -s" and it is an alias! */
  
***************
*** 716,720 ****
  
      /* Look for the "-s statusvalue" text */
!     if (Status)
      {
  	s_rec->status = def_status;
--- 716,720 ----
  
      /* Look for the "-s statusvalue" text */
!     if (capsstatus)
      {
  	s_rec->status = def_status;
***************
*** 779,788 ****
      struct winsize ws;
  
!     (void) ioctl (0, TIOCGWINSZ, &ws);
      cols = ws.ws_col;
  #endif
  #endif
  
!     Status = status;
  
      /* Read the whole modules file into allocated records */
--- 779,792 ----
      struct winsize ws;
  
! #ifdef __MWERKS__
! 	(void) ioctl (0, TIOCGWINSZ, (long *) &ws);
! #else
! 	(void) ioctl (0, TIOCGWINSZ, &ws);
! #endif
      cols = ws.ws_col;
  #endif
  #endif
  
!     capsstatus = status;
  
      /* Read the whole modules file into allocated records */
diff -r -C 2 -P base/cvs-1.6.5/src/myndbm.c cvs-1.6.5/src/myndbm.c
*** base/cvs-1.6.5/src/myndbm.c	Wed Jan  3 06:20:24 1996
--- cvs-1.6.5/src/myndbm.c	Tue Jan  9 05:33:08 1996
***************
*** 37,41 ****
      DBM *db;
  
!     fp = fopen (file, "r");
      if (fp == NULL && !(existence_error (errno) && (flags & O_CREAT)))
  	return ((DBM *) 0);
--- 37,41 ----
      DBM *db;
  
!     fp = CVS_FOPEN (file, "r");
      if (fp == NULL && !(existence_error (errno) && (flags & O_CREAT)))
  	return ((DBM *) 0);
***************
*** 77,81 ****
      {
  	FILE *fp;
! 	fp = fopen (db->name, "w");
  	if (fp == NULL)
  	    error (1, errno, "cannot write %s", db->name);
--- 77,81 ----
      {
  	FILE *fp;
! 	fp = CVS_FOPEN (db->name, "w");
  	if (fp == NULL)
  	    error (1, errno, "cannot write %s", db->name);
diff -r -C 2 -P base/cvs-1.6.5/src/no_diff.c cvs-1.6.5/src/no_diff.c
*** base/cvs-1.6.5/src/no_diff.c	Fri Sep  8 07:20:28 1995
--- cvs-1.6.5/src/no_diff.c	Tue Jan  9 05:33:08 1996
***************
*** 98,102 ****
  	     * has been set to 1.  */
  	    if (trace)
! 		(void) fprintf (stderr, "%c-> unlink (%s)\n",
  #ifdef SERVER_SUPPORT
  				(server_active) ? 'S' : ' ',
--- 98,102 ----
  	     * has been set to 1.  */
  	    if (trace)
! 		(void) fprintf (stderr, "%c-> CVS_UNLINK (%s)\n",
  #ifdef SERVER_SUPPORT
  				(server_active) ? 'S' : ' ',
***************
*** 105,109 ****
  #endif
  				tocvsPath);
! 	    if (unlink (tocvsPath) < 0)
  		error (0, errno, "could not remove %s", tocvsPath);
  	}
--- 105,109 ----
  #endif
  				tocvsPath);
! 	    if (CVS_UNLINK (tocvsPath) < 0)
  		error (0, errno, "could not remove %s", tocvsPath);
  	}
***************
*** 127,133 ****
  			(server_active) ? 'S' : ' ', tmp);
  #else
! 	(void) fprintf (stderr, "-> unlink (%s)\n", tmp);
  #endif
!     if (unlink (tmp) < 0)
  	error (0, errno, "could not remove %s", tmp);
      free (options);
--- 127,133 ----
  			(server_active) ? 'S' : ' ', tmp);
  #else
! 	(void) fprintf (stderr, "-> CVS_UNLINK (%s)\n", tmp);
  #endif
!     if (CVS_UNLINK (tmp) < 0)
  	error (0, errno, "could not remove %s", tmp);
      free (options);
diff -r -C 2 -P base/cvs-1.6.5/src/parseinfo.c cvs-1.6.5/src/parseinfo.c
*** base/cvs-1.6.5/src/parseinfo.c	Tue Oct 17 07:20:14 1995
--- cvs-1.6.5/src/parseinfo.c	Tue Jan  9 05:33:08 1996
***************
*** 48,52 ****
      (void) sprintf (infopath, "%s/%s/%s", CVSroot,
  		    CVSROOTADM, infofile);
!     if ((fp_info = fopen (infopath, "r")) == NULL)
  	return (0);			/* no file -> nothing special done */
  
--- 48,52 ----
      (void) sprintf (infopath, "%s/%s/%s", CVSroot,
  		    CVSROOTADM, infofile);
!     if ((fp_info = CVS_FOPEN (infopath, "r")) == NULL)
  	return (0);			/* no file -> nothing special done */
  
diff -r -C 2 -P base/cvs-1.6.5/src/patch.c cvs-1.6.5/src/patch.c
*** base/cvs-1.6.5/src/patch.c	Thu Jan  4 06:20:30 1996
--- cvs-1.6.5/src/patch.c	Tue Jan  9 05:33:08 1996
***************
*** 302,306 ****
  
      /* cd to the starting repository */
!     if (chdir (repository) < 0)
      {
  	error (0, errno, "cannot chdir to %s", repository);
--- 302,306 ----
  
      /* cd to the starting repository */
!     if (CVS_CHDIR (repository) < 0)
      {
  	error (0, errno, "cannot chdir to %s", repository);
***************
*** 428,436 ****
  	return (0);
      }
!     if ((fp1 = fopen (tmpnam (tmpfile1), "w+")) != NULL)
  	(void) fclose (fp1);
!     if ((fp2 = fopen (tmpnam (tmpfile2), "w+")) != NULL)
  	(void) fclose (fp2);
!     if ((fp3 = fopen (tmpnam (tmpfile3), "w+")) != NULL)
  	(void) fclose (fp3);
      if (fp1 == NULL || fp2 == NULL || fp3 == NULL)
--- 428,436 ----
  	return (0);
      }
!     if ((fp1 = CVS_FOPEN (tmpnam (tmpfile1), "w+")) != NULL)
  	(void) fclose (fp1);
!     if ((fp2 = CVS_FOPEN (tmpnam (tmpfile2), "w+")) != NULL)
  	(void) fclose (fp2);
!     if ((fp3 = CVS_FOPEN (tmpnam (tmpfile3), "w+")) != NULL)
  	(void) fclose (fp3);
      if (fp1 == NULL || fp2 == NULL || fp3 == NULL)
diff -r -C 2 -P base/cvs-1.6.5/src/rcs.c cvs-1.6.5/src/rcs.c
*** base/cvs-1.6.5/src/rcs.c	Mon Dec  4 06:20:22 1995
--- cvs-1.6.5/src/rcs.c	Tue Jan  9 05:33:08 1996
***************
*** 144,148 ****
  
      (void) sprintf (rcsfile, "%s/%s%s", repos, file, RCSEXT);
!     if ((fp = fopen (rcsfile, "r")) != NULL) 
      {
          rcs = RCS_parsercsfile_i(fp, rcsfile);
--- 144,148 ----
  
      (void) sprintf (rcsfile, "%s/%s%s", repos, file, RCSEXT);
!     if ((fp = CVS_FOPEN (rcsfile, "r")) != NULL) 
      {
          rcs = RCS_parsercsfile_i(fp, rcsfile);
***************
*** 166,170 ****
  
      (void) sprintf (rcsfile, "%s/%s/%s%s", repos, CVSATTIC, file, RCSEXT);
!     if ((fp = fopen (rcsfile, "r")) != NULL) 
      {
          rcs = RCS_parsercsfile_i(fp, rcsfile);
--- 166,170 ----
  
      (void) sprintf (rcsfile, "%s/%s/%s%s", repos, CVSATTIC, file, RCSEXT);
!     if ((fp = CVS_FOPEN (rcsfile, "r")) != NULL) 
      {
          rcs = RCS_parsercsfile_i(fp, rcsfile);
***************
*** 204,208 ****
  
      /* open the rcsfile */
!     if ((fp = fopen (rcsfile, "r")) == NULL)
      {
  	error (0, errno, "Couldn't open rcs file `%s'", rcsfile);
--- 204,208 ----
  
      /* open the rcsfile */
!     if ((fp = CVS_FOPEN (rcsfile, "r")) == NULL)
      {
  	error (0, errno, "Couldn't open rcs file `%s'", rcsfile);
***************
*** 308,312 ****
  #endif
  
!     fp = fopen(rcsfile, "r");
      if (fp == NULL)
  	error (1, 0, "unable to reopen `%s'", rcsfile);
--- 308,312 ----
  #endif
  
!     fp = CVS_FOPEN (rcsfile, "r");
      if (fp == NULL)
  	error (1, 0, "unable to reopen `%s'", rcsfile);
diff -r -C 2 -P base/cvs-1.6.5/src/recurse.c cvs-1.6.5/src/recurse.c
*** base/cvs-1.6.5/src/recurse.c	Sat Dec 16 06:20:33 1995
--- cvs-1.6.5/src/recurse.c	Tue Jan  9 05:33:08 1996
***************
*** 519,523 ****
  
  	/* cd to the sub-directory */
! 	if (chdir (dir) < 0)
  	    error (1, errno, "could not chdir to %s", dir);
  
--- 519,523 ----
  
  	/* cd to the sub-directory */
! 	if (CVS_CHDIR (dir) < 0)
  	    error (1, errno, "could not chdir to %s", dir);
  
***************
*** 631,635 ****
          if (save_cwd (&cwd))
  	    exit (1);
! 	if (chdir (p->key) < 0)
  	    error (1, errno, "could not chdir to %s", p->key);
  
--- 631,635 ----
          if (save_cwd (&cwd))
  	    exit (1);
! 	if (CVS_CHDIR (p->key) < 0)
  	    error (1, errno, "could not chdir to %s", p->key);
  
diff -r -C 2 -P base/cvs-1.6.5/src/release.c cvs-1.6.5/src/release.c
*** base/cvs-1.6.5/src/release.c	Tue Jan  9 06:20:21 1996
--- cvs-1.6.5/src/release.c	Tue Jan  9 05:33:08 1996
***************
*** 143,147 ****
          if (isdir (thisarg))
          {
!           if (chdir (thisarg) < 0)
            {
              if (!really_quiet)
--- 143,147 ----
          if (isdir (thisarg))
          {
!           if (CVS_CHDIR (thisarg) < 0)
            {
              if (!really_quiet)
***************
*** 273,280 ****
      ino_t ino;
  
!     (void) stat (".", &st);
      ino = st.st_ino;
!     (void) chdir ("..");
!     (void) stat (dir, &st);
      if (ino != st.st_ino)
      {
--- 273,280 ----
      ino_t ino;
  
!     (void) CVS_STAT (".", &st);
      ino = st.st_ino;
!     (void) CVS_CHDIR ("..");
!     (void) CVS_STAT (dir, &st);
      if (ino != st.st_ino)
      {
diff -r -C 2 -P base/cvs-1.6.5/src/remove.c cvs-1.6.5/src/remove.c
*** base/cvs-1.6.5/src/remove.c	Thu Jan  4 06:20:31 1996
--- cvs-1.6.5/src/remove.c	Tue Jan  9 05:33:08 1996
***************
*** 128,132 ****
  	if (!noexec)
  	{
! 	    if (unlink (file) < 0 && ! existence_error (errno))
  	    {
  		if (update_dir[0] == '\0')
--- 128,132 ----
  	if (!noexec)
  	{
! 	    if (CVS_UNLINK (file) < 0 && ! existence_error (errno))
  	    {
  		if (update_dir[0] == '\0')
diff -r -C 2 -P base/cvs-1.6.5/src/root.c cvs-1.6.5/src/root.c
*** base/cvs-1.6.5/src/root.c	Tue Dec 12 06:20:28 1995
--- cvs-1.6.5/src/root.c	Tue Jan  9 05:33:08 1996
***************
*** 136,142 ****
      int ret;
  
!     if (stat (dir1, &sb1) < 0)
          return (0);
!     if (stat (dir2, &sb2) < 0)
          return (0);
      
--- 136,142 ----
      int ret;
  
!     if (CVS_STAT (dir1, &sb1) < 0)
          return (0);
!     if (CVS_STAT (dir2, &sb2) < 0)
          return (0);
      
diff -r -C 2 -P base/cvs-1.6.5/src/rtag.c cvs-1.6.5/src/rtag.c
*** base/cvs-1.6.5/src/rtag.c	Thu Jan  4 06:20:31 1996
--- cvs-1.6.5/src/rtag.c	Tue Jan  9 05:33:08 1996
***************
*** 279,283 ****
  
      /* chdir to the starting directory */
!     if (chdir (repository) < 0)
      {
  	error (0, errno, "cannot chdir to %s", repository);
--- 279,283 ----
  
      /* chdir to the starting directory */
!     if (CVS_CHDIR (repository) < 0)
      {
  	error (0, errno, "cannot chdir to %s", repository);
diff -r -C 2 -P base/cvs-1.6.5/src/run.c cvs-1.6.5/src/run.c
*** base/cvs-1.6.5/src/run.c	Fri Dec 15 06:20:21 1995
--- cvs-1.6.5/src/run.c	Tue Jan  9 05:33:08 1996
***************
*** 216,220 ****
      mode_err |= ((flags & RUN_STDERR_APPEND) ? O_APPEND : O_TRUNC);
  
!     if (stin && (shin = open (stin, O_RDONLY)) == -1)
      {
  	rerrno = errno;
--- 216,220 ----
      mode_err |= ((flags & RUN_STDERR_APPEND) ? O_APPEND : O_TRUNC);
  
!     if (stin && (shin = CVS_OPEN (stin, O_RDONLY)) == -1)
      {
  	rerrno = errno;
***************
*** 223,227 ****
  	goto out0;
      }
!     if (stout && (shout = open (stout, mode_out, 0666)) == -1)
      {
  	rerrno = errno;
--- 223,227 ----
  	goto out0;
      }
!     if (stout && (shout = CVS_OPEN (stout, mode_out, 0666)) == -1)
      {
  	rerrno = errno;
***************
*** 232,236 ****
      if (sterr && (flags & RUN_COMBINED) == 0)
      {
! 	if ((sherr = open (sterr, mode_err, 0666)) == -1)
  	{
  	    rerrno = errno;
--- 232,236 ----
      if (sterr && (flags & RUN_COMBINED) == 0)
      {
! 	if ((sherr = CVS_OPEN (sterr, mode_err, 0666)) == -1)
  	{
  	    rerrno = errno;
diff -r -C 2 -P base/cvs-1.6.5/src/server.c cvs-1.6.5/src/server.c
*** base/cvs-1.6.5/src/server.c	Thu Jan  4 06:20:33 1996
--- cvs-1.6.5/src/server.c	Tue Jan  9 05:33:08 1996
***************
*** 392,396 ****
  	return;
      }
!     if (chdir (dirname) < 0)
      {
  	pending_error = errno;
--- 392,396 ----
  	return;
      }
!     if (CVS_CHDIR (dirname) < 0)
      {
  	pending_error = errno;
***************
*** 411,415 ****
  	return;
      }
!     f = fopen (CVSADM_REP, "w");
      if (f == NULL)
      {
--- 411,415 ----
  	return;
      }
!     f = CVS_FOPEN (CVSADM_REP, "w");
      if (f == NULL)
      {
***************
*** 428,432 ****
  	return;
      }
!     f = fopen (CVSADM_ENT, "w+");
      if (f == NULL)
      {
--- 428,432 ----
  	return;
      }
!     f = CVS_FOPEN (CVSADM_ENT, "w+");
      if (f == NULL)
      {
***************
*** 493,497 ****
  {
      FILE *f;
!     f = fopen (CVSADM_ENTSTAT, "w+");
      if (f == NULL)
      {
--- 493,497 ----
  {
      FILE *f;
!     f = CVS_FOPEN (CVSADM_ENTSTAT, "w+");
      if (f == NULL)
      {
***************
*** 515,519 ****
  {
      FILE *f;
!     f = fopen (CVSADM_TAG, "w+");
      if (f == NULL)
      {
--- 515,519 ----
  {
      FILE *f;
!     f = CVS_FOPEN (CVSADM_TAG, "w+");
      if (f == NULL)
      {
***************
*** 626,630 ****
  
      /* Write the file.  */
!     fd = open (arg, O_WRONLY | O_CREAT | O_TRUNC, 0600);
      if (fd < 0)
      {
--- 626,630 ----
  
      /* Write the file.  */
!     fd = CVS_OPEN (arg, O_WRONLY | O_CREAT | O_TRUNC, 0600);
      if (fd < 0)
      {
***************
*** 798,802 ****
      {
  	struct utimbuf ut;
! 	int fd = open (arg, O_WRONLY | O_CREAT | O_TRUNC, 0666);
  	if (fd < 0 || close (fd) < 0)
  	{
--- 798,802 ----
      {
  	struct utimbuf ut;
! 	int fd = CVS_OPEN (arg, O_WRONLY | O_CREAT | O_TRUNC, 0666);
  	if (fd < 0 || close (fd) < 0)
  	{
***************
*** 914,918 ****
      if (!error_pending ())
      {
! 	f = fopen (CVSADM_ENT, "w");
  	if (f == NULL)
  	{
--- 914,918 ----
      if (!error_pending ())
      {
! 	f = CVS_FOPEN (CVSADM_ENT, "w");
  	if (f == NULL)
  	{
***************
*** 1091,1095 ****
      while (notify_list != NULL)
      {
! 	if (chdir (notify_list->dir) < 0)
  	{
  	    error (0, errno, "cannot change to %s", notify_list->dir);
--- 1091,1095 ----
      while (notify_list != NULL)
      {
! 	if (CVS_CHDIR (notify_list->dir) < 0)
  	{
  	    error (0, errno, "cannot change to %s", notify_list->dir);
***************
*** 2300,2304 ****
  #endif /* SERVER_FLOWCONTROL */
  
!     dev_null_fd = open ("/dev/null", O_RDONLY);
      if (dev_null_fd < 0)
      {
--- 2300,2304 ----
  #endif /* SERVER_FLOWCONTROL */
  
!     dev_null_fd = CVS_OPEN ("/dev/null", O_RDONLY);
      if (dev_null_fd < 0)
      {
***************
*** 2943,2947 ****
  	char *mode_string;
  
! 	if (stat (file, &sb) < 0)
  	{
  	    /* Not clear to me why the file would fail to exist, but it
--- 2943,2947 ----
  	char *mode_string;
  
! 	if (CVS_STAT (file, &sb) < 0)
  	{
  	    /* Not clear to me why the file would fail to exist, but it
***************
*** 3217,3221 ****
  	}
  
! 	if (chdir (tempdir) < 0)
  	{
  	    printf ("E Cannot change to directory %s\n", tempdir);
--- 3217,3221 ----
  	}
  
! 	if (CVS_CHDIR (tempdir) < 0)
  	{
  	    printf ("E Cannot change to directory %s\n", tempdir);
***************
*** 3283,3287 ****
  	char size_text[80];
  
! 	if (stat (file, &sb) < 0)
  	{
  	    if (existence_error (errno))
--- 3283,3287 ----
  	char size_text[80];
  
! 	if (CVS_STAT (file, &sb) < 0)
  	{
  	    if (existence_error (errno))
***************
*** 3370,3374 ****
  		pid_t gzip_pid;
  
! 		fd = open (file, O_RDONLY, 0);
  		if (fd < 0)
  		    error (1, errno, "reading %s", short_pathname);
--- 3370,3374 ----
  		pid_t gzip_pid;
  
! 		fd = CVS_OPEN (file, O_RDONLY, 0);
  		if (fd < 0)
  		    error (1, errno, "reading %s", short_pathname);
***************
*** 3396,3400 ****
  
  		size = sb.st_size;
! 		f = fopen (file, "r");
  		if (f == NULL)
  		    error (1, errno, "reading %s", short_pathname);
--- 3396,3400 ----
  
  		size = sb.st_size;
! 		f = CVS_FOPEN (file, "r");
  		if (f == NULL)
  		    error (1, errno, "reading %s", short_pathname);
***************
*** 3427,3431 ****
  	       join_file.  */
  	    && !joining ())
! 	    unlink (file);
      }
      else if (scratched_file != NULL && entries_line == NULL)
--- 3427,3431 ----
  	       join_file.  */
  	    && !joining ())
! 	    CVS_UNLINK (file);
      }
      else if (scratched_file != NULL && entries_line == NULL)
***************
*** 3673,3677 ****
  {
      FILE *f;
!     f = fopen (CVSADM_CIPROG, "w+");
      if (f == NULL)
      {
--- 3673,3677 ----
  {
      FILE *f;
!     f = CVS_FOPEN (CVSADM_CIPROG, "w+");
      if (f == NULL)
      {
***************
*** 3702,3706 ****
  {
      FILE *f;
!     f = fopen (CVSADM_UPROG, "w+");
      if (f == NULL)
      {
--- 3702,3706 ----
  {
      FILE *f;
!     f = CVS_FOPEN (CVSADM_UPROG, "w+");
      if (f == NULL)
      {
***************
*** 3919,3923 ****
      if (temp_dir == NULL || temp_dir[0] == '\0')
          temp_dir = "/tmp";
!     chdir(temp_dir);
  
      len = strlen (server_temp_dir) + 80;
--- 3919,3923 ----
      if (temp_dir == NULL || temp_dir[0] == '\0')
          temp_dir = "/tmp";
!     CVS_CHDIR (temp_dir);
  
      len = strlen (server_temp_dir) + 80;
***************
*** 4160,4164 ****
    memset (linebuf, 0, linelen);
  
!   fp = fopen (filename, "r");
    if (fp == NULL)
      {
--- 4160,4164 ----
    memset (linebuf, 0, linelen);
  
!   fp = CVS_FOPEN (filename, "r");
    if (fp == NULL)
      {
diff -r -C 2 -P base/cvs-1.6.5/src/tag.c cvs-1.6.5/src/tag.c
*** base/cvs-1.6.5/src/tag.c	Thu Jan  4 06:20:33 1996
--- cvs-1.6.5/src/tag.c	Tue Jan  9 05:33:08 1996
***************
*** 729,733 ****
  	    if (save_cwd (&cwd))
  		exit (1);
! 	    if (chdir (repository) < 0)
  		error (1, errno, "cannot change to %s directory", repository);
  	}
--- 729,733 ----
  	    if (save_cwd (&cwd))
  		exit (1);
! 	    if (CVS_CHDIR (repository) < 0)
  		error (1, errno, "cannot change to %s directory", repository);
  	}
diff -r -C 2 -P base/cvs-1.6.5/src/update.c cvs-1.6.5/src/update.c
*** base/cvs-1.6.5/src/update.c	Thu Jan  4 06:20:34 1996
--- cvs-1.6.5/src/update.c	Tue Jan  9 05:33:09 1996
***************
*** 255,259 ****
--- 255,261 ----
  			if (rq->status == rq_supported)
  			{
+ #ifndef macintosh
  			    send_arg("-u");
+ #endif
  			}
  			break;
***************
*** 275,279 ****
  
  		if (toplevel_wd[0] != '\0'
! 		    && chdir (toplevel_wd) < 0)
  		{
  		    error (1, errno, "could not chdir to %s", toplevel_wd);
--- 277,281 ----
  
  		if (toplevel_wd[0] != '\0'
! 		    && CVS_CHDIR (toplevel_wd) < 0)
  		{
  		    error (1, errno, "could not chdir to %s", toplevel_wd);
***************
*** 814,818 ****
      /* run the update_prog if there is one */
      if (err == 0 && !pipeout && !noexec &&
! 	(fp = fopen (CVSADM_UPROG, "r")) != NULL)
      {
  	char *cp;
--- 816,820 ----
      /* run the update_prog if there is one */
      if (err == 0 && !pipeout && !noexec &&
! 	(fp = CVS_FOPEN (CVSADM_UPROG, "r")) != NULL)
      {
  	char *cp;
***************
*** 837,841 ****
      /* FIXME: chdir ("..") loses with symlinks.  */
      /* Prune empty dirs on the way out - if necessary */
!     (void) chdir ("..");
      if (update_prune_dirs && isemptydir (dir))
      {
--- 839,843 ----
      /* FIXME: chdir ("..") loses with symlinks.  */
      /* Prune empty dirs on the way out - if necessary */
!     (void) CVS_CHDIR ("..");
      if (update_prune_dirs && isemptydir (dir))
      {
***************
*** 859,863 ****
      struct dirent *dp;
  
!     if ((dirp = opendir (dir)) == NULL)
      {
  	error (0, 0, "cannot open directory %s for empty check", dir);
--- 861,865 ----
      struct dirent *dp;
  
!     if ((dirp = CVS_OPENDIR (dir)) == NULL)
      {
  	error (0, 0, "cannot open directory %s for empty check", dir);
***************
*** 1207,1211 ****
      else
      {
!         e = fopen (file1, "r");
  	if (e == NULL)
  	    fail = 1;
--- 1209,1213 ----
      else
      {
!         e = CVS_FOPEN (file1, "r");
  	if (e == NULL)
  	    fail = 1;
***************
*** 1244,1248 ****
  		    && !fileattr_get (file, "_watched"))
  		    xchmod (file2, 1);
! 		e = fopen (file2, "r");
  		if (e == NULL)
  		    fail = 1;
--- 1246,1250 ----
  		    && !fileattr_get (file, "_watched"))
  		    xchmod (file2, 1);
! 		e = CVS_FOPEN (file2, "r");
  		if (e == NULL)
  		    fail = 1;
***************
*** 1303,1307 ****
  
  	    /* Check the diff output to make sure patch will be handle it.  */
! 	    e = fopen (file, "r");
  	    if (e == NULL)
  		error (1, errno, "could not open diff output file %s", file);
--- 1305,1309 ----
  
  	    /* Check the diff output to make sure patch will be handle it.  */
! 	    e = CVS_FOPEN (file, "r");
  	    if (e == NULL)
  		error (1, errno, "could not open diff output file %s", file);
***************
*** 1333,1337 ****
  		  xvers_ts->tag, xvers_ts->date, NULL);
  
! 	if (stat (file2, file_info) < 0)
  	    error (1, errno, "could not stat %s", file2);
  
--- 1335,1339 ----
  		  xvers_ts->tag, xvers_ts->date, NULL);
  
! 	if (CVS_STAT (file2, file_info) < 0)
  	    error (1, errno, "could not stat %s", file2);
  
diff -r -C 2 -P base/cvs-1.6.5/src/vers_ts.c cvs-1.6.5/src/vers_ts.c
*** base/cvs-1.6.5/src/vers_ts.c	Sat Dec  2 06:20:24 1995
--- cvs-1.6.5/src/vers_ts.c	Tue Jan  9 05:33:09 1996
***************
*** 220,224 ****
      char *cp;
  
!     if (stat (file, &sb) < 0)
      {
  	if (! existence_error (errno))
--- 220,224 ----
      char *cp;
  
!     if (CVS_STAT (file, &sb) < 0)
      {
  	if (! existence_error (errno))
***************
*** 280,284 ****
      char *ts;
  
!     if (stat (file, &sb) < 0)
      {
  	ts = NULL;
--- 280,284 ----
      char *ts;
  
!     if (CVS_STAT (file, &sb) < 0)
      {
  	ts = NULL;
diff -r -C 2 -P base/cvs-1.6.5/src/wrapper.c cvs-1.6.5/src/wrapper.c
*** base/cvs-1.6.5/src/wrapper.c	Tue Oct 10 07:20:42 1995
--- cvs-1.6.5/src/wrapper.c	Tue Jan  9 05:33:09 1996
***************
*** 97,101 ****
  
  	/* load the file */
!     if (!(fp = fopen (file, "r")))
  	return;
      while (fgets (line, sizeof (line), fp))
--- 97,101 ----
  
  	/* load the file */
!     if (!(fp = CVS_FOPEN (file, "r")))
  	return;
      while (fgets (line, sizeof (line), fp))
